package com.example.validdemo.model;

import com.example.validdemo.util.PatternUtil;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import java.io.Serializable;

/**
 * 系统用户
 *
 * @author Bx_Hu
 */
@Data
@Accessors(chain = true)
public class SysUser implements Serializable {

    @ApiModelProperty(value = "用户id")
    private Long userId;

    /**
     * 用户名
     */
    @ApiModelProperty(value = "用户名")
    @NotBlank(message = "用户名必填")
    @Size(message = "用户名字数不可大于20", max = 20)
    private String username;

    /**
     * 密码
     */
    @ApiModelProperty(value = "密码")
    @NotBlank(message = "密码必填")
    @Pattern(regexp = PatternUtil.REG_PASSWORD, message = "密码格式不正确")
    private String password;

    /**
     * 邮箱
     */
    @ApiModelProperty(value = "邮箱")
    @NotBlank(message = "邮箱必填")
    @Pattern(regexp = PatternUtil.REG_EMAIL, message = "邮箱格式不正确")
    private String email;

    /**
     * 手机号
     */
    @ApiModelProperty(value = "手机号")
    @NotBlank(message = "手机号必填")
    @Pattern(regexp = PatternUtil.REG_MOBILE, message = "手机号格式不正确")
    private String mobile;

    /**
     * 性别  0：男   1：女
     */
    @ApiModelProperty(value = "性别  0：男   1：女")
    @NotNull(message = "性别必选")
    private Integer sex;

    /**
     * 状态  0：禁用   1：正常
     */
    @ApiModelProperty(value = "状态  0：禁用   1：正常")
    private Integer status;


    private static final long serialVersionUID = 1L;
}
